/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.time.LocalDate;

/**
 * <p>Project: jse2306 - Ex2</p>
 * <p>Powered by webrx On 2023-10-10 11:41:15</p>
 * <p>description: </p>
 *
 * @author 李四 [webrx@126.com 19832424243]
 * @version 1.0
 * @since 17
 */
public class Ex3 {
    public static void main(String[] args) {
        //写程序判断年份是不是闰年。 （if()
        //int year = 2024;

        int year = LocalDate.now().getYear(); //获取当前计算机的日期年份

        //1.判断语句 if(逻辑运算表达式){}else{}
        if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) {
            System.out.printf("%d年是闰年%n", year);
        } else {
            System.out.printf("%d年是平年%n", year);
        }

        //2.三元运算表达式 ? :
        System.out.println(LocalDate.now().isLeapYear() ? "闰年" : "平年");
    }
}
